package com.example.app2024.TransitionAnimat.scene;

import android.os.Bundle;
import android.transition.Scene;
import android.transition.Transition;
import android.transition.TransitionInflater;
import android.transition.TransitionManager;
import android.view.View;
import android.view.ViewGroup;

import androidx.appcompat.app.AppCompatActivity;

import com.example.app2024.R;

public class SceneActivity extends AppCompatActivity
{

      private Scene mOverViewScene;
      private Scene mInfoScene;

      @Override
      protected void onCreate(Bundle savedInstanceState)
      {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_scene);

            ViewGroup sceneRoot = findViewById(R.id.scene_root);
            mOverViewScene = Scene.getSceneForLayout(sceneRoot, R.layout.scene_overview, this);
            mInfoScene = Scene.getSceneForLayout(sceneRoot, R.layout.scene_info, this);

            TransitionManager.go(mOverViewScene);
      }

      public void onClick(View view)
      {
            if (view.getId() == R.id.btnInfo)
            {
                  Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.transition);
                  TransitionManager.go(mInfoScene, transition);
            }
            else if (view.getId() == R.id.btnClose)
            {
                  TransitionManager.go(mOverViewScene);
            }
      }
}
